package com.plian.system.mapper.sys;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.plian.system.entity.sys.ServiceOrg;
import com.plian.system.vo.sys.BaseServiceOrgRecordVO;
import com.plian.system.vo.sys.ServiceOrgVO;
import io.lettuce.core.dynamic.annotation.Param;

import java.util.List;

public interface ServiceOrgMapper extends BaseMapper<ServiceOrg> {

    /**
     * 根据主表id获取 最新数据
     * @param baseServiceOrgId
     * @param orgCode
     * @return
     */
    List<ServiceOrgVO> getLatestTreeList(@Param("baseServiceOrgId") Long baseServiceOrgId, @Param("orgCode") String orgCode);


    IPage<BaseServiceOrgRecordVO> recordList(IPage<BaseServiceOrgRecordVO> page, @Param("baseServiceOrgId") Long baseServiceOrgId);

    /**
     * 根据主表id、时间 获取数据
     * @param baseServiceOrgId
     * @param queryTime
     * @return
     */
    List<ServiceOrgVO> getTreeListByTime(@Param("baseServiceOrgId") Long baseServiceOrgId,
                                         @Param("queryTime") String queryTime,
                                        @Param("orgCode") String orgCode);

    ServiceOrg getOneByBaseServiceOrgIdAndTimeAndMainVersionInitialId(@Param("mainVersionInitialId") String mainVersionInitialId,
                                                                      @Param("baseServiceOrgId") Long baseServiceOrgId,
                                                                      @Param("queryTime") String queryTime);

}
